UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qI9rgDKV/IszZSW/OLo0I/qK0WPegkj92ApPlcgXwrw='
WHERE
key_id = 'b7a470b8aa99822e91c83f796bab7acd3a42eb3ea36b3e4f180ba51cda32ab3f'
AND (
token = 'qI9rgDKV/IszZSW/OLo0I/qK0WPegkj92ApPlcgXwrw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)