UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8yynONOqkZOKUhcdFn+UORHAWILip0Az987PxnPB04s='
WHERE
key_id = '598f8a11f3064d41350a85e410748e916637be5cfc4690dd70a78fc88eadcbf0'
AND (
token = '8yynONOqkZOKUhcdFn+UORHAWILip0Az987PxnPB04s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)