UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4lse2P0dydJKKSAS3fWjkgnkees6nOm/Ho4yeo1oBGo='
WHERE
key_id = '58addc8e10a0eceb5998b58aa541849b9ee19badb107d03f9de070a13d1d8aa8'
AND (
token = '4lse2P0dydJKKSAS3fWjkgnkees6nOm/Ho4yeo1oBGo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)