UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'U0JjBC3vrX5y+5erihfufH8jPq4To7O/j2riEgdrtfE='
WHERE
key_id = 'cf0cbe65cf92156c13501f394d66574f101e63ca032723eda2366b017a76bd39'
AND (
token = 'U0JjBC3vrX5y+5erihfufH8jPq4To7O/j2riEgdrtfE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)