UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XBZXf+jDaADkhpSVUn95m3+gn1P5Crvje7CR9deJMWE='
WHERE
key_id = 'f68c2b2222c62c728691c85f45608c5bbfb49d6e1e48626271f5f1bbcc919bce'
AND (
token = 'XBZXf+jDaADkhpSVUn95m3+gn1P5Crvje7CR9deJMWE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)