UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T7EIqEJpnCZIWTQTGUWC0rUv8KDRJnXpv9wGxZi71uk='
WHERE
key_id = '852dc5fa62e899410e1caddf4d4de216735eea7023fb48bb118b9046ac7ceb8a'
AND (
token = 'T7EIqEJpnCZIWTQTGUWC0rUv8KDRJnXpv9wGxZi71uk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)