UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2aCXSER+we6Gdfr3gamPTRv79rX0n+q3luIuCFIMosU='
WHERE
key_id = 'db67d7346cdc9512154584d1bd7aa5faa49ebe022ea991fda3f15bcd81785086'
AND (
token = '2aCXSER+we6Gdfr3gamPTRv79rX0n+q3luIuCFIMosU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)