UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yGwhrZubvnofUZSEB/NtxA6gPrpKQ8/SNkugo6UYVd0=' 
WHERE 
  key_id = 'db9d5b1a03006f815560fc8a40eddb46373b5064f52243e3e30781b72edfaad6' 
  AND (
    token = 'yGwhrZubvnofUZSEB/NtxA6gPrpKQ8/SNkugo6UYVd0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027