UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eXBl1cJ0Xyj3pUPTgGl9TvdvchMAo/u15Vt3FBUjuho=' 
WHERE 
  key_id = '0b55ac51a1b4c908f97be3ffef0662089be92bda3e5af950e58826462122baf9' 
  AND (
    token = 'eXBl1cJ0Xyj3pUPTgGl9TvdvchMAo/u15Vt3FBUjuho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043