UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MD1DwgpPY5znubybckGdXi3weWeTgecZER6KQU/rq84='
WHERE
key_id = 'a2366b46b137df429726ed1bd90c7401ed90a76224a5f1433c8a2ccf6c4d6358'
AND (
token = 'MD1DwgpPY5znubybckGdXi3weWeTgecZER6KQU/rq84='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)