UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rG1bBf6PFLo4d9esowgsYtV2fMpPQwpw80D7hJaya74=' 
WHERE 
  key_id = '893ed15bcf822021269d40f4bad3cbd7ac48fdcb25f7c4e8840db6767eeefd7d' 
  AND (
    token = 'rG1bBf6PFLo4d9esowgsYtV2fMpPQwpw80D7hJaya74=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056