UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8yREPbB9668A1z9ukOkehua87lPGCuz8yeZ7hJinqaA=' 
WHERE 
  key_id = 'bb5e96230598efcf9740249db5c4b8df95e0f3af00962d9c1ddb4e35aba99602' 
  AND (
    token = '8yREPbB9668A1z9ukOkehua87lPGCuz8yeZ7hJinqaA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027