UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MOsR8JR054TA9CDMHO13zecKOjaDuTswlQO+glW5YdA=' 
WHERE 
  key_id = '0d0a54b3aec42de0888346d2c677666bd4cb5c720b41aa935d49d7ceec6a39a6' 
  AND (
    token = 'MOsR8JR054TA9CDMHO13zecKOjaDuTswlQO+glW5YdA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043