UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cYwDiIx+CDirrbx99nPPM/yXd+TKgqqkyDCiD1SUoQk='
WHERE
key_id = 'fa97151879ea2af08b1ed87803b2e5a6ca8788d98ba203f5efabbca1929cf6c2'
AND (
token = 'cYwDiIx+CDirrbx99nPPM/yXd+TKgqqkyDCiD1SUoQk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)