UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'faGCiK/E8T4kTqG0BtxO2jpWBJi1Nhpbv2dyfcd+2fU=' 
WHERE 
  key_id = 'be176d032aeef0761eb6ec2d5d69f36818686d88e0772eef5e18565ed1b862cf' 
  AND (
    token = 'faGCiK/E8T4kTqG0BtxO2jpWBJi1Nhpbv2dyfcd+2fU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021