UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J/LyqdHHYlVVdvi8VoocpNi9bU3hqq/8eVBUfCRYN+0='
WHERE
key_id = '87709e4800b7872c287a8373a9c37bfa45496c2971036a823d6f16a9d3d33611'
AND (
token = 'J/LyqdHHYlVVdvi8VoocpNi9bU3hqq/8eVBUfCRYN+0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)