UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0irXP5ys1qKLEKoK1YtodMO0NYVl6AqEf0dj6YQj2Hk='
WHERE
key_id = '91c09ccb12d4e8867474c6375df021faf953bc33ca25c44c8a539020679f7e2e'
AND (
token = '0irXP5ys1qKLEKoK1YtodMO0NYVl6AqEf0dj6YQj2Hk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)