UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Yupnj+AFHC2q6JqmOpEYNfpoJ7UwFQ1DD0BrXPrA9Nk='
WHERE
key_id = 'ed186e71e2c3ce917f4e62fb51c9e48e3b15e9c8e3629692142f15378de01e6a'
AND (
token = 'Yupnj+AFHC2q6JqmOpEYNfpoJ7UwFQ1DD0BrXPrA9Nk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)