UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VUYVbpXtMer0599+KQujqek+WmBkXldcgeT5HOONhhI='
WHERE
key_id = 'f1f67981b885f5db05f8679ffad7f4cb48bcef4b5dcf5ec2fc4eff087f9d33bb'
AND (
token = 'VUYVbpXtMer0599+KQujqek+WmBkXldcgeT5HOONhhI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)