UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HS4zYKexrt8r/fOyss0Y1T+QPHS0CCNqyc5XCMVhhTo=' 
WHERE 
  key_id = '4d9db1bd492827985e7a0a8ff2c3b1a6084e6b16782b42f2a99bcb708a0573bd' 
  AND (
    token = 'HS4zYKexrt8r/fOyss0Y1T+QPHS0CCNqyc5XCMVhhTo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029