UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hZOHeBSDrK86kFpfCla8oXtjc0njiSnGpTf3wZFkJu8='
WHERE
key_id = 'ae71937f496b1df9a1caebd020006f8eec1b9cb80f2c44bd305ae5134787b5d1'
AND (
token = 'hZOHeBSDrK86kFpfCla8oXtjc0njiSnGpTf3wZFkJu8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)