UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KG6nwb4ZYoNdLueE0ORUM/3EAWaWSc8CqQIp0qbVKAw=' 
WHERE 
  key_id = '743bdd81ad1771f89b97f5952bbd0ca92439331576b3921020b848537e6ba89d' 
  AND (
    token = 'KG6nwb4ZYoNdLueE0ORUM/3EAWaWSc8CqQIp0qbVKAw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034