UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'diZQTwQbSmIeoWShyaUgwLYqVudWM0rA47qEOIGJQew='
WHERE
key_id = '4cf591b88ac1d6693499d8997d41041d1fe5f32c2b2fce22c1353b45af2a1003'
AND (
token = 'diZQTwQbSmIeoWShyaUgwLYqVudWM0rA47qEOIGJQew='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)