UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+exU/U/hPxIpSwwRw4DVYqSUIxCsi27anzAzZAXZG24='
WHERE
key_id = 'c54480d83e8785e6bab79d282ad440daaaccb70ad426364f391e67332f8f3fea'
AND (
token = '+exU/U/hPxIpSwwRw4DVYqSUIxCsi27anzAzZAXZG24='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)