UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gVhnEv8OJE42FYAdoMoJxpCRirR4iTlEcwAjnoHqhOM=' 
WHERE 
  key_id = 'b85777dc32b26d3fa59039d86e8f056be9afbfa31f38147dce31065693192a41' 
  AND (
    token = 'gVhnEv8OJE42FYAdoMoJxpCRirR4iTlEcwAjnoHqhOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028