UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ioieg9kAD8yScDecQWYpmIlEL4eyWUw8HLSGGGg1DWw='
WHERE
key_id = '3c741a9c7e33155724b5d5213e059f6e64c6f5e3cea573a63230012acab7ed12'
AND (
token = 'ioieg9kAD8yScDecQWYpmIlEL4eyWUw8HLSGGGg1DWw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)