UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w6VPzPKR/cpMrbLEdod2SaafnQtczZOURN5tm2fIVow='
WHERE
key_id = 'b82b527bf4cedf6274067f91318fd84d2296fd8818841c457ea0265a0901f134'
AND (
token = 'w6VPzPKR/cpMrbLEdod2SaafnQtczZOURN5tm2fIVow='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)