UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aTM30r4B8biV/ACcYRDYjDrYInJ2W73/b5NbJQAzkjg=' 
WHERE 
  key_id = '374c5aef6a30904d32f7a22dcba3a35681547e99827676e19a87610fee273699' 
  AND (
    token = 'aTM30r4B8biV/ACcYRDYjDrYInJ2W73/b5NbJQAzkjg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050