UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'L5kXHm1Atx8/yjp6swXFyihNqLnGmLLGEMONWyvytEI='
WHERE
key_id = '3948bedf465260ab028e218211137e5c660dc809a5499ed57f2a7c5f0a0f7ccb'
AND (
token = 'L5kXHm1Atx8/yjp6swXFyihNqLnGmLLGEMONWyvytEI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)