UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8hJ3v1P6ImEfuCpK8JaBg3wBexlrPoD0JeIVkqKab3g='
WHERE
key_id = '29ee0f62918b9889e83248bebf18d043b4d16ca30fce76d17c631df4b0db8b37'
AND (
token = '8hJ3v1P6ImEfuCpK8JaBg3wBexlrPoD0JeIVkqKab3g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)