UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5ewhO1YvyovgcMXdcEUXxeE24GEmZ1LgVqJ7uXMCAr8='
WHERE
key_id = 'a0335855f2f6a96d133eb4b104957ce16f8eff99ee15cfa3ec974b09cbd548f9'
AND (
token = '5ewhO1YvyovgcMXdcEUXxeE24GEmZ1LgVqJ7uXMCAr8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)