UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CTOEAlZXsSb2noEvrkVg9LGxI6eeRWTqY5/IBM5sQyk=' 
WHERE 
  key_id = '1fded02e69fea3e2264643bd4212cd67f41b2a57a49e9cca201385c312200c13' 
  AND (
    token = 'CTOEAlZXsSb2noEvrkVg9LGxI6eeRWTqY5/IBM5sQyk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040