UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dA+aeEtgNGpYUdz1mhC2Wu33osKh8WjsJiNJaaaEhkU='
WHERE
key_id = 'a32fb640bbe761f9f4bd4a5aa9fdddcf4d62550534cfc1721a44d95d6b61777a'
AND (
token = 'dA+aeEtgNGpYUdz1mhC2Wu33osKh8WjsJiNJaaaEhkU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)