UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uo+NWj9NgWMCM1iSF9kzYoSyDpUF0nW6tlpEFwacNT0='
WHERE
key_id = 'c5b8482d6a26b6863f72b1d92a091ae8f8a8a26da11f26dedf55d7097a47786c'
AND (
token = 'uo+NWj9NgWMCM1iSF9kzYoSyDpUF0nW6tlpEFwacNT0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)