UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GT+O9bj9ih4E0WSJg+Rs5q1ZgOzoru02B7wFmIb6zKw='
WHERE
key_id = '4e00541b261f0648e64b1d4987d1cc548163ad680bc0847cdc0d7da4a91047be'
AND (
token = 'GT+O9bj9ih4E0WSJg+Rs5q1ZgOzoru02B7wFmIb6zKw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)