UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aJKJdU/AizhgnWk+cquo01CqsJ5Vs4pWH9nge4FfBGY='
WHERE
key_id = 'ac987d5da616d11892993933b2f0d3ae9b5879fc4dfa03364c03744570e4d74a'
AND (
token = 'aJKJdU/AizhgnWk+cquo01CqsJ5Vs4pWH9nge4FfBGY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)