UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5xZJXmJMUcT6L6n8b13GkKDx2Mxwa90EY4z5bA+VePM='
WHERE
key_id = '6ee56b69a3ded39624f8ae83344c2350686300f1038985d9709b1de1dfbbc1a6'
AND (
token = '5xZJXmJMUcT6L6n8b13GkKDx2Mxwa90EY4z5bA+VePM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)