UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qzb4RBAbEB6amNt1b0hUaC0QwBfswUq6AwHi3WNjQow='
WHERE
key_id = '6d75282cb74b0f33a1151f630f795540fc888c9a8d6c7af25975b1ea1bbe5b51'
AND (
token = 'qzb4RBAbEB6amNt1b0hUaC0QwBfswUq6AwHi3WNjQow='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)