UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Tmdy0P1LrKHvxPYBLKPpyYmDChMlZPE27yTD2IfOG5M='
WHERE
key_id = '5fe1921390b79f87286e791844d3ffca0aa066765345bf02994310aec55ad312'
AND (
token = 'Tmdy0P1LrKHvxPYBLKPpyYmDChMlZPE27yTD2IfOG5M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)