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