UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ms8Z7HpfHNwuzvTuvKOhZMaU7N/RWHY5xFIs7lU5UbY='
WHERE
key_id = '3c8c2f45f757e99a6f3fe8e2fd196ec6c38e4e4cd3df6b0cd38c776245bf7ab7'
AND (
token = 'ms8Z7HpfHNwuzvTuvKOhZMaU7N/RWHY5xFIs7lU5UbY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)