UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dK/WtOK8jNaUH102qhnLUlKShNOCpNrnk+qFVrtv+po='
WHERE
key_id = 'e0f1b049d5e83d89728a04a8bcd8b1af7be44cb32eaa1fe9fc71ce01f57315c0'
AND (
token = 'dK/WtOK8jNaUH102qhnLUlKShNOCpNrnk+qFVrtv+po='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)