UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Jfo0tgOu9yoVDH457atZaUvUNYnJ/E5a+baYNIrzNpk='
WHERE
key_id = 'd4c2a6fd60210081f207cf06a342674cd35657b4939c56c1b971354cbc219660'
AND (
token = 'Jfo0tgOu9yoVDH457atZaUvUNYnJ/E5a+baYNIrzNpk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)