UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f0P1uq3wwPFfcODCujAitjvLCccFrh9A/vc5wrOPZEs='
WHERE
key_id = '6f01af61d46a1ada9071b390070908f3779fbf3c16c315b4e79f6a85b9d7da29'
AND (
token = 'f0P1uq3wwPFfcODCujAitjvLCccFrh9A/vc5wrOPZEs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)