UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6lWRLOuzUT3N1N4S+PBWz2OVGkJW+3Rpgde97VvuD9o='
WHERE
key_id = 'e229b4b7da629dfb0be7a575d782b4159d9002621d1b5b7b72834618a6bd81bb'
AND (
token = '6lWRLOuzUT3N1N4S+PBWz2OVGkJW+3Rpgde97VvuD9o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)