UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XdBp64cQBBOJDuD0q75pzfIRktEfjsGwV9TEFL84yLo='
WHERE
key_id = '25b5ec68d0d9c2870153cef9b8febf22a799d6011e33eeea883b89cc006bee67'
AND (
token = 'XdBp64cQBBOJDuD0q75pzfIRktEfjsGwV9TEFL84yLo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)